<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
    String path = request.getContextPath();
%>
<html>
<head>

    <title>Document</title>
    <jsp:include page="WEB-INF/jsp/common/css_js.jsp"/>
    <style>
        .body {
            background: url('<%=path%>/img/bg.jpg');
            background-repeat: no-repeat;
            background-size: 100% auto;

        }
    </style>

</head>
<body class="body">

<div  id="login-box">
    <h3>管理员登录</h3>
    <br>
    <div class="form">
        <div class="item">
            <div class="form-group" style="width: 200px; margin: 0 auto;">
                <input type="text" class="form-control" id="admName1" placeholder="name"><br>
                <input type="password" class="form-control" id="admPassword1" placeholder="Password">
            </div>
        </div>
    </div>
    <div class="layui-btn-container">
        <button type="button"  class="layui-btn layui-btn-primary layui-btn-radius" onclick="admLogin()" >进入系统</button>
    </div>


</div>

<script>
    function admLogin() {
        $.ajax({
            url:"admin/login",
            method:"post",
            data:{
                username:$("#admName1").val(),
                password:$("#admPassword1").val(),
            },
            success:function (data) {
                if (data['code']==0){
                    location.href="admin.jsp";
                }else {
                    alert(data['message']);
                }
            },error:function (e) {
                console.log(e);
            }
        })
    }
</script>
</body>
</html>
